{{- if .Values.extendedMonitoring.certificates.exporterEnabled }}
  {{- if (.Values.global.enabledModules | has "operator-prometheus-crd") }}
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: cert-exporter
  namespace: d8-monitoring
  {{- include "helm_lib_module_labels" (list . (dict "prometheus" "main")) | nindent 2 }}
spec:
  jobLabel: app
  podMetricsEndpoints:
  - port: https-metrics
    scheme: https
    bearerTokenSecret:
      name: "prometheus-token"
      key: "token"
    tlsConfig:
      insecureSkipVerify: true
    honorLabels: true
    scrapeTimeout: {{ include "helm_lib_prometheus_target_scrape_timeout_seconds" (list . 25) }}
  selector:
    matchLabels:
      app: cert-exporter
  namespaceSelector:
    matchNames:
    - d8-monitoring
  {{- end }}
{{- end }}
